#!/usr/bin/python

import os
from datetime import datetime, timedelta

N = (64, 128, 256, 512, 1024, 2048)
# M = ('IJK', 'IKJ', 'JIK', 'JKI', 'KIJ', 'KJI')
# D = (0, )
M = ('IJKIJ', )
D = range(10)

for d in D:
    for n in N:
        for m in M:
            time = timedelta(seconds=0)
            start = datetime.now()
            os.system('./MxM.{}.{}.{}.3 > /dev/null'.format(n, d, m))
            time += datetime.now() - start
            start = datetime.now()
            os.system('./MxM.{}.{}.{}.3 > /dev/null'.format(n, d, m))
            time += datetime.now() - start
            start = datetime.now()
            os.system('./MxM.{}.{}.{}.3 > /dev/null'.format(n, d, m))
            time += datetime.now() - start
            start = datetime.now()
            os.system('./MxM.{}.{}.{}.3 > /dev/null'.format(n, d, m))
            time += datetime.now() - start
            print("{}\t{}\t{}\t{}".format(n, m, d, time.total_seconds() / 4))
